import cv2
video=cv2.VideoCapture('landscaps.avi')
fps=video.get(cv2.CAP_PROP_FPS)
size=(int(video.get(cv2.CAP_PROP_FRAME_WIDTH)),
      int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)))
fource=cv2.VideoWriter_fourcc(*'XVID')
output=cv2.VideoWriter('out.avi',fource,fps,size)
while(video.isOpened()):
    retval,frame=video.read()
    if retval:
        output.write(frame)
    else:
        break
print('视频已保存')
video.release()
output.release()
